package com.spring.framework.config.event.scheduled;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @author xuweizhi
 */
public class AnnScheduleStart {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AnnScheduleMethodConfig.class);
        //阻塞15秒让其运行调度任务
        LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(20));
        ac.close();
        System.out.println("20秒内执行调度任务次数: " + AnnScheduleMethodConfig.SCHEDULED_COUNT.sum());
    }
}
